package org.yxing.palpalgps;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.TextView;

public abstract class AbstractActivity extends BaseActivity {
    FrameLayout mFrameLayout;
    private ActionBar mActionBar;
    
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.content);
        mFrameLayout = (FrameLayout) findViewById(R.id.frameLayout);
        mActionBar = (ActionBar) findViewById(R.id.action_bar);
    }
    
    public void setContentView(int layoutResID) {
        LayoutInflater.from(this).inflate(layoutResID, mFrameLayout);
    }
    
    public void setTitle(String text) {
        ((TextView) findViewById(R.id.titleView)).setText(text);
    }
    
    public void addActionBarItem(int resId) {
        mActionBar.addItem(resId);
    }
    
    public void addActionBarItem(ActionBar.Type type) {
        mActionBar.addItem(type);
    }
    
    public ActionBar getActionBar() {
        return mActionBar;
    }
}
